package com.le.tester.webpage.secKill.service.impl;

import com.le.tester.common.enums.ResponseCode;
import com.le.tester.dao.OrderInfoMapper;
import com.le.tester.entity.OrderInfo;
import com.le.tester.handler.BusinessException;
import com.le.tester.webpage.secKill.service.OrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 描述：订单逻辑实现
 */
@Service
public class OrderServiceImpl implements OrderService {

    private static final Logger LOG = LoggerFactory.getLogger(OrderServiceImpl.class);

    @Resource
    private OrderInfoMapper orderInfoMapper;

    @Override
    public OrderInfo getOrderDetail(long orderId) {
        OrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);
        if (null == orderInfo) {
            throw new BusinessException(ResponseCode.ERROR.getDesc());
        } else {
            return orderInfo;
        }
    }
}
